import requests
from bs4 import BeautifulSoup

class CodeMarket:
    def __init__(self):
        self.URL = 'https://codemart.com/projects/'
        #self.header = { 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36'}
        self.header = { 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36' }

    def get_project(self):
        for page in range(1, 2):
            page = str(page)
            html = requests.get(self.URL, params={'page': page}, headers = self.header)
            #html = requests.get("https://codemart.com/projects/?page=1")
            html.content.decode("utf-8")
            #print(html.text)
            soup = BeautifulSoup(html.text, "html.parser")
            #print(soup.get_text())
            for i in range(1,10):

                name = soup.select('#container > div > div > div > div > div > div.left-container-1dwXK > div.list-container--j7Ng > div > div > div:nth-child(' + str(i) + ') > div > div.body-content-2y6ks > div > div.title-2q5sH > a > span.name-UUeBS > span')
                #name = soup.select(' #container > div > div > div > div > div > div.left-container-1dwXK > div.list-container--j7Ng > div > div > div:nth-child(3) >  div > div.body-content-2y6ks > div > div.title-2q5sH > a > span.name-UUeBS > span')
                print(name)

if __name__ == "__main__":
    cls = CodeMarket()
    cls.get_project()